package net.lainiao.morethread.Chapter1.demo8;

import java.util.Random;

/**
 * Created by Administrator on 2017/2/28.
 */
public class Task implements Runnable {

    @Override
    public void run() {
        int result;
        Random random=new Random(Thread.currentThread().getId());
        while (true){
            result=1000/((int)(random.nextDouble()*1000));
            System.out.println("Thread "+Thread.currentThread().getId()+" Value="+result);
            if(Thread.currentThread().isInterrupted()){
                System.out.println(Thread.currentThread().getId()+" Interrupted");
                return;
            }
        }

    }
}
